#include "stm32f10x.h"
#include "FreeRTOS.h"
#include "task.h"
#include "time.h"
#include "FreeRTOSConfig.h"
#include "led.h"


TaskHandle_t first_handle = NULL;
#define PORTTICK_MS(MS) portTICK_PERIOD_MS*MS

void LED_Task(void *Param)
{
	while(1)
	{
		LED_Light_ON();
		vTaskDelay(PORTTICK_MS(1000));
		LED_Light_Off();
		vTaskDelay(PORTTICK_MS(1000));
	}
}

/***************************************
Designation Name: BSP_Init
Date: 2023.11.14
Auther: ys.wang
Function: 初始化配置
***************************************/
static void First_Task(void *Param)
{
	taskENTER_CRITICAL();           /* 进入临界区 */
    //内存管理

    //驱动管理
    // MGER_DRIVE_NEWObj();
	xTaskCreate(LED_Task,"LED_Task",configMINIMAL_STACK_SIZE,NULL,configMAX_PRIORITIES-3,&first_handle);
	
	vTaskDelete(NULL);
	taskEXIT_CRITICAL();            /* 退出临界区 */
}


/***************************************
Designation Name:main
Date:2023.6.11
Auther:ys.wang
Function:主函数
***************************************/
int main(void)
{
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
	LEDInit_Config();

	//4.创建第一个任务
	xTaskCreate(First_Task,"First_Task",configMINIMAL_STACK_SIZE,NULL,configMAX_PRIORITIES-1,&first_handle);
	/* 启动调度器 */
	vTaskStartScheduler();
}


